import { defineConfig } from "@mikro-orm/mariadb";
import { EntityGenerator } from "@mikro-orm/entity-generator";

const { mysqlUser: user, mysqlPass: pass } = process.env;

export default defineConfig({
    // It is important that entities will point to the compiled JS files, and entitiesTs will point to the TS source files. You should not mix those.
    entities: ["./dist/entities"],
    entitiesTs: ["./src/entities"],

    // default since v4, so not needed to specify explicitly
    // metadataProvider: ReflectMetadataProvider,
    host: "127.0.0.1",
    port: 3306,
    user: user || "root",
    password: pass || "root",
    dbName: "work",

    allowGlobalContext: true,

    extensions: [EntityGenerator],
});
